#!/bin/bash

ARG=$1
GATEIP=192.168.32.193
NET=(10.0.0.0/8 192.168.3.0/24 192.168.1.0/24 192.168.8.0/24 54.223.0.0/16 192.168.9.0/24)
#NET=(10.0.0.0/8)

delete_route() {
    for i in ${NET[@]}
    do 
        expect <<END > /tmp/expectExec.log 2>&1
        spawn  sudo route delete $i
        expect { 
            "Password:" { send "1\r"; exp_continue }
            eof
        }
END
    done
}


add_route() {
    for i in ${NET[@]}
    do
        expect <<END > /tmp/expectExec.log 2>&1
        spawn sudo route add $i $GATEIP
        expect {
            "Password:"  { send "1\r"; exp_continue }
            eof
        }
END
    done
}

delete_route
add_route
#    sudo route add 172.16.105.0/24 $GATEIP
